home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9539 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1013 b   |  50 lines

  1. Path: futon.SFSU.EDU!mclean
  2. From: mclean@futon.SFSU.EDU (Emmett Mclean)
  3. Newsgroups: comp.sources.wanted,comp.lang.c,comp.unix.programmer
  4. Subject: Seek unix2dos.c OR help with tr
  5. Date: 11 Mar 1996 04:10:46 GMT
  6. Organization: San Francisco State University
  7. Message-ID: <4i0946$7io@nuke.csu.net>
  8. NNTP-Posting-Host: futon.sfsu.edu
  9.  
  10. Hi,
  11.  
  12. Does anyone have the source to a program
  13. converting a unix file into dos format?
  14. That is, each decimal 10 char is replaced
  15. with a series of a 10 and 13.
  16.  
  17. The equivalent syntax to tr would be fine
  18. as well.
  19.  
  20. I will be using it to download zipped binaries
  21. files from a unix box.
  22.  
  23. Ah, writing the program is a bit trickier
  24. than the little program below since the
  25. program exits prematurely because getchar reads
  26. EOF from its input - before getting to
  27. the real EOF.
  28.  
  29.  
  30. I archied unix2dos but the one ftp sites 
  31. with unix2dos had an empty directory.
  32.  
  33.  
  34.  
  35. #include <stdio.h>
  36. main(){
  37. char c;
  38. while(EOF!=(c=getchar())){
  39.  if(10==c)putchar(13);
  40.  putchar(c);
  41.  }
  42.  putchar(10);
  43. }
  44.  
  45.  
  46. Thanks,
  47.  
  48. Emmett
  49.  
  50.